home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 1.3 KB | 69 lines | [TEXT/CWIE] |
- // FileAccessPath.h
-
- #ifndef FileAccessPath_h
- #define FileAccessPath_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
- #ifndef FilePermission_h
- #include "FilePermission.h"
- #endif
- #ifndef Assert_h
- #include "Assert.h"
- #endif
-
- class FileLocation;
-
- class FileAccessPath
- {
- private:
- int16 refNum;
- bool isOpen;
-
- // intentionally undefined:
- FileAccessPath( const FileAccessPath& );
- void operator=( const FileAccessPath& );
-
- static void ThrowError( OSErr );
-
- public:
- enum DataFork { dataFork };
- enum ResourceFork { resourceFork };
-
- FileAccessPath();
- FileAccessPath( const FileLocation&,
- FilePermission,
- DataFork = dataFork );
-
- FileAccessPath( const FileLocation&,
- FilePermission,
- ResourceFork );
-
- ~FileAccessPath();
-
- bool IsOpen() const { return isOpen; }
-
- void Open( const FileLocation&,
- FilePermission,
- DataFork = dataFork );
-
- void Open( const FileLocation&,
- FilePermission,
- ResourceFork );
-
- void Close();
-
- int16 RefNum() const { Assert( isOpen ); return refNum; }
-
- uint32 Length() const;
- void SetLength( uint32 );
-
- uint32 Allocate( uint32 ); // returns amount actually allocated;
- uint32 AllocateContiguous( uint32 ); // throws disk full on failure.
-
- void Flush() const;
- };
-
- #endif
-